<template>

<!-- <el-backtop target=".page-component__scroll .el-scrollbar__wrap"> -->
  <div class="zuida demo-image__lazy" ref='zuida'>
    
    <back></back>
    <!-- <el-backtop target=".page-component__scroll .el-scrollbar__wrap"></el-backtop> -->
    
    <div class="paihang1" ref="tips" style="display:none" @click="up"><i class="el-icon-upload2"></i>top</div>
    <div class="zuo"></div>
    <div class="you">
      <div class="jieguo">
      搜索结果
    </div>
      <div v-for='(item,index) in list' :key="index" class="dan">
        <div class="tou">
        <el-image 
    style="width: 50px; height: 50px"
    :src="item.tou" 
    :preview-src-list="[item.tou]" lazy>
  </el-image>
          <!-- <img :src="wen.tou" alt=""> -->
          <div class="name">{{item.user}}<br>{{item.date}}</div>
        </div>
      <div class="title">{{item.title}} </div>
        <!-- <h4></h4> -->
      {{item.content}} <br/>
      <div class="img">
        <div v-for="(itemimg,index1) in item.img" :key="index1" class="imgzong">
        <el-image 
    :src="itemimg" 
    :preview-src-list="item.img" class="getu" lazy>
  </el-image>
        </div>
      </div>
      <div class="pinglun">
        <div class="icon" @click="tiaoxiangxi(item.id)"><i class="el-icon-chat-line-square"></i>
        
        <!-- {{ping[item.id]}} -->
        <!-- {{pinglun(item.id)}} -->
        {{item.pinglun}}
        <!-- 11 -->
        </div>
        <!-- <div class="icon"><i class="el-icon-lollipop"></i>111</div> -->
        <div class="icon"><i class="el-icon-view"></i>{{item.liulan}}</div>
       
      </div>
    </div>
    <div class="meiyou">
      <!-- <h1>没有更多了</h1> -->
      <i class="el-icon-circle-close"></i>抱歉,没有更多了
    </div>
    </div>
    
    <!-- <el-backtop target=".zuida"></el-backtop> -->
  </div>
  <!-- </el-backtop> -->
  
</template>
<script>
// import Tou from './zujian/shang.vue'
import back from './zujian/back.vue'
export default {
  components:{
    back
  },
  data(){
    return {
      index:'2',
      list:[],
      litop:0
    }
  },
  methods:{
    tiaoxiangxi(val){
      this.axios.get('/kan/'+val).then((res)=>{
      console.log(res);
    })
      this.$router.push('/wenzhang/'+val)
    },
    up(){
      window.scrollTo(0, 0)
    },
    gundong(){
      let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
	        // console.log(scrollTop)
          this.litop=scrollTop
        if(this.litop>=1000){
          this.$refs.tips.style.display='block'
        }
        else{
          this.$refs.tips.style.display='none'
        }
    },
    shuaxin(){
      console.log('刷新了');
    }
  },
  
  mounted(){
    this.$store.commit('indexbian',this.index)
    window.addEventListener('scroll',this.gundong),
    // this.open()
    window.addEventListener('beforeunload', this.shuaxin);
  },
  beforeDestroy () {
      		window.removeEventListener('scroll', this.gundong)
    	},
  created(){
      this.$store.commit('bian')
      // console.log(this.$route.params.search);
      var search=this.$route.params.search
      console.log(search);
      this.axios.post("/search",{guanjian:search}).then((res)=>{
          console.log(res.data);
          for(var i=0;i<res.data.length;i++){
          console.log(typeof res.data[i].img);
          res.data[i].img=eval(res.data[i].img)
          // var acc=JSON.parse(res.data[i].img)
          // console.log(acc);
          // this.list=res.data
        }
          this.list=res.data
        })
    }
}
</script>
<style lang="less" scoped>
  .zuida{
    // overflow: scroll;
    // display: none;
    // overflow-y: scroll;
    width: 70%;
    margin: 0 auto;
    // height: 30000px;
    // background-color: red;
    margin-top: 40px;
    display: flex;
    justify-content:space-around;
    // background-color: red;
  }
  .zuo{
    width: 20%;
    // background-color: blue;
    // position:fixed;
    // top: 100px;
    // height: 100px;
  }
  .you{
    padding-top: 10px;
    width: 70%;
    background-color: #f1f1f1;
    // margin-left: 10px;
    padding-left: 20px;
    padding-right: 20px;
    border-radius: 20px;
  }
  .dan{
    width: 100%;
    .img{
      width: 100%;
      display: flex;
      // background-color: blueviolet;
      flex-wrap:wrap;
      // justify-content:space-around;
      // margin-right: ;
      .imgzong{
        margin-left: 4px;
        display: flex;
        justify-content:center;
        width: 32%;
        border-radius: 20px;
        // overflow: hidden;
        height: 260px;
        overflow: hidden;
        
      }
      
    }
    .tou{
      display: flex;
      color: #7b8084;
      margin-bottom: 10px;
      /deep/ .el-image{
        border-radius: 25px;
      }
    .name{
      margin-left: 20px;
      margin-top: 10px;
    }
  }
  .pinglun{
    margin-top: 10px;
  width: 100%;
  height: 34px;
  // background-color: rgb(95, 229, 77);
  display: flex;
  .icon{
    line-height: 34px;
    font-size: 18px;
    width: 30%;
    text-align: center;
  }
}
  }
  .paihang{
    width: 300px;
    height: 580px;
    background-color: #d4f1d5;
    border-radius: 10px;
    position: fixed;
    top: 130px;
    left: 280px;
  }
  .paihang1{
    width: 50px;
    height: 50px;
    background-color: #d4f1d5;
    border-radius: 10px;
    position: fixed;
    text-align: center;
    line-height: 50px;
    top: 300px;
    right:130px;
  }
  /deep/ .getu{
          width: 100%;
          // height: 100%;
          // 
          
          img{
            width: 100%;
            // height: 50%;
            // display: block;
            object-fit: cover;
          }
        }
.title{
    color: #000000;
    font-size: 22px;
  }
  [v-cloak]{
    display: none;
  }
  .jieguo{
    width: 100%;
    height: 50px;
    line-height: 50px;
    text-align: center;
    font-size: 17px;
  }
  .meiyou{
    width: 100%;
    // height: 200px;
    height: 60px;
    line-height: 60px;
    text-align: center;
    font-size: 20px;
    // background-color: red;
  }
</style>